This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This approach may yet turn out to be unworkable, but I'm going to keep plugging away at it. The basic idea is that
server.js
becomesapp/server.js
, the entry point for a bundle that includes a generated manifest that gets passed to the middleware, rather than everything happening behind the scenes. Similarly,templates/main.js
becomesapp/client.js
, and imports theroutes
from a generated manifest file.A number of things follow from this design decision:
app/server.js
androutes/foo/bar.js
are part of the same bundle, and can use the same modules (say, something that manages credentials). Everything goes through the bundler, so you can e.g. use TypeScript and ESM everywheresapper dev
, perhaps — responsible for coordinating all thatfetch
implementation to use insapper export
, for example, because the server needs to run in a child process controlled by the CLI. (I suspect the answer will be toprocess.send
middleware responses to the CLI.) Also, I currently have no idea how hot module replacement will workAs part of these changes, there will be a single page template file —
app/template.html
— and 4xx and 5xx responses will useroutes/4xx.html
androutes/5xx.html
components. There is also now a webpack config forapp/service-worker.js
(if you have one), so all the webpack config now sits in its own directory.There'll need to be a migration guide from 0.6 to 0.7, as I don't think
sapper upgrade
will suffice.